<template>
	<view class="container">
		<public-module></public-module>
		<f-navbar title="个人中心" fontColor="#fff" :bgColor="PrimaryColor" :scrollTop="scrollTop" navbarType='5'
			:isShowLeft="false" :isShowTransparentTitle="false"></f-navbar>
		<view class="bg-top bg-blue">
			<view class="top-box shadow">

				<view class="cu-list menu">

					<view class="cu-item" style="padding: 0;">
						<view class="content">
							<text class="cuIcon-rechargefill text-green"></text>
							<text class="text-black">账号</text>
						</view>
						<view class="action">
							<view class="u-demo-block__content" style="margin-top: 15px;">
								<!-- 注意：由于兼容性差异，如果需要使用前后插槽，nvue下需使用u--input，非nvue下需使用u-input -->
								<!-- #ifndef APP-NVUE -->
								<u-input  border="none"  inputAlign="right" placeholder="请输入账号">
								<!-- #endif -->
									<!-- #ifdef APP-NVUE -->
									<u--input  inputAlign="right" placeholder="请输入账号">
									<!-- #endif -->
										<template slot="suffix">
											<u-code ref="uCode" @change="codeChange" seconds="20"
												changeText="X秒重新获取哈哈哈"></u-code>
											<u-button @tap="getCode" :text="tips" type="success" size="mini">一键填入</u-button>
										</template>
								<!-- #ifndef APP-NVUE -->
								</u-input>
								<!-- #endif -->
								<!-- #ifdef APP-NVUE -->
								</u--input>
								<!-- #endif -->
							</view>
							<!-- <u--input placeholder="请输入账号" border="none" v-model="form.title" inputAlign="right"
								clearable></u--input> -->
							<!-- 								<button class="cu-btn round sm shadow bg-red margin-left" >待处理</button> -->


						</view>
					</view>
					<view class="cu-item" style="padding: 0;">
						<view class="content">
							<text class="cuIcon-myfill text-blue"></text>
							<text class="text-black">集团名称</text>
						</view>
						<view class="action">
							<u--input placeholder="请输入集团名称" border="none" v-model="form.name" inputAlign="right"
								clearable></u--input>
						</view>
					</view>
					<view class="cu-item" style="padding: 0;">
						<view class="content">
							<text class="cuIcon-mobilefill text-blue"></text>
							<text class="text-black">地址</text>
						</view>
						<view class="action">
							<u--input placeholder="请输入地址" border="none" v-model="form.mobile" inputAlign="right"
								clearable></u--input>
						</view>
					</view>
					<view class="cu-item" style="padding: 0;">
						<view class="content">
							<text class="cuIcon-mobilefill text-blue"></text>
							<text class="text-black">光猫SN</text>
						</view>
						<view class="action">
							<u--input placeholder="请输入光猫SN" border="none" v-model="form.mobile" inputAlign="right"
								clearable></u--input>
						</view>
					</view>
					<view class="cu-item" style="padding: 0;">
						<view class="content">
							<text class="cuIcon-mobilefill text-blue"></text>
							<text class="text-black">电视账号</text>
						</view>
						<view class="action">
							<u--input placeholder="请输入电视账号" border="none" v-model="form.mobile" inputAlign="right"
								clearable></u--input>
						</view>
					</view>
					<view class="cu-item" style="padding: 0;">
						<view class="content">
							<text class="cuIcon-mobilefill text-blue"></text>
							<text class="text-black">电视密码</text>
						</view>
						<view class="action">
							<u--input placeholder="请输入电视密码" border="none" v-model="form.mobile" inputAlign="right"
								clearable></u--input>
						</view>
					</view>

				</view>

			</view>

			<!-- 加入按钮 -->
			<view class="padding-lr flex margin-top-sm" style="justify-content: space-between;">
				<button class="cu-btn bg-blue margin-top-sm lg" @click="submit()" style="width: 46%;">创建工单</button>
				<button class="cu-btn bg-red margin-top-sm lg" style="width: 46%;">重置</button>
			</view>
			<u-action-sheet :show="showCate" :actions="actions" title="请选择分类" description="" @close="showCate = false"
				@select="cateSelect">
			</u-action-sheet>

		</view>
		<!-- 		<f-tabbar></f-tabbar> -->

	</view>
</template>

<script>
	import {
		mapState,
		mapMutations
	} from 'vuex';
	import fTabbar from '@/components/module/f-tabbar/f-tabbar';
	import fNavbar from '@/components/module/f-navbar/f-navbar';

	// import request from '@/common/request.js';
	export default {
		components: {
			fNavbar,
			fTabbar
		},
		computed: {
			...mapState(['PrimaryColor', 'userInfo']),
			freeSpecsButtonBackground() {
				return this.$u.colorToRgba(this.$u.rgbToHex(this.PrimaryColor), 0.75)
			},
		},
		data() {
			return {
				scrollTop: 0,
				joinList: [{

					},
					{

					}
				],
				form: {},
				fileList1: [],
				showCate: false,

				actions: [{
						name: '主干扩容',
					},
					{
						name: '分光器扩容',
					},
					{
						name: 'DTS补点',
					},
					{
						name: '空白新增',
					},
				],
			}
		},
		onShow() {

		},
		onLoad() {
			// 隐藏原生的tabbar
			uni.hideTabBar();
		},
		onReachBottom() {

		},
		onShareAppMessage() {
			return {
				title: '分享'
			}
		},
		methods: {
			submit() {
				this.$u.toast('工单创建成功');

				setTimeout(() => {
					uni.navigateTo({
						url: '/pages/enterprise/list'
					});
				}, 1000); // 设置延时时间为3秒（3000毫秒）
			},
			cateSelect(e) {
				this.form.cate = e.name
				// 	this.$refs.uForm.validateField('userInfo.sex')
			},
			// 删除图片
			deletePic(event) {
				this[`fileList${event.name}`].splice(event.index, 1)
			},
			// 新增图片
			async afterRead(event) {
				// 当设置 multiple 为 true 时, file 为数组格式，否则为对象格式
				let lists = [].concat(event.file)
				let fileListLen = this[`fileList${event.name}`].length
				lists.map((item) => {
					this[`fileList${event.name}`].push({
						...item,
						status: 'uploading',
						message: '上传中'
					})
				})
				for (let i = 0; i < lists.length; i++) {
					const result = await this.uploadFilePromise(lists[i].url)
					let item = this[`fileList${event.name}`][fileListLen]
					this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
						status: 'success',
						message: '',
						url: result
					}))
					fileListLen++
				}
			},
			uploadFilePromise(url) {
				return new Promise((resolve, reject) => {
					let a = uni.uploadFile({
						url: 'http://192.168.2.21:7001/upload', // 仅为示例，非真实的接口地址
						filePath: url,
						name: 'file',
						formData: {
							user: 'test'
						},
						success: (res) => {
							setTimeout(() => {
								resolve(res.data.data)
							}, 1000)
						}
					});
				})
			}
		}
	}
</script>
<style lang="scss" scoped>
	// .bg-blue {
	// 	background-image: linear-gradient(45deg, #727CFB, #46D0ED);

	// 	color: #ffffff;
	// }

	.container {
		width: 750rpx;
		color: #333333;

		.bg-top {
			margin-top: -1rpx;
			width: 750rpx;
			height: 320rpx;
			padding-top: 100rpx;
			border-radius: 0 0 20% 20%;

			.top-box {
				width: 700rpx;
				background-color: #FFFFFF;
				margin: 0 auto;
				border-radius: 20rpx;
				padding: 20rpx 30rpx 0rpx;
				position: relative;

				.qh-pic {
					position: absolute;
					right: 64rpx;
					top: -50rpx;
					border-radius: 12rpx;
				}

				.qh-title {
					width: 100%;
					height: 60rpx;
					line-height: 65rpx;
					text-align: center;
					// 	padding-right: 190rpx;
				}

				.bxBox {
					position: relative;
					display: flex;
					/* padding: 0 30rpx; */
					min-height: 100rpx;
					/* background-color: #ffffff; */
					/* justify-content: space-between; */
					align-items: center;
					font-size: 30rpx;
					line-height: 1.6em;
					flex: 1;

					.bxImg {
						display: inline-block;
						margin-right: 10rpx;
						width: 1.6em;
						text-align: center;
					}
				}

			}
		}

		.center-box {
			color: #333333;
			width: 700rpx;
			background-color: #FFFFFF;
			margin: 0 auto;
			border-radius: 20rpx;
			padding: 0rpx 30rpx 0rpx;
			position: relative;
			margin-top: 20rpx;
		}
	}
</style>